from fastapi import APIRouter, HTTPException
from fastapi import Depends
from app.service.user import UserService

router = APIRouter(prefix="/user", tags=["user"])

@router.get("/info/{user_id}")
async def get_user(user_id: str,user_service: UserService = Depends(UserService)):
    # 自定义异常
    if user_id != "haha":
        raise HTTPException(status_code=404, detail="Item not found")

    return await user_service.get_user(user_id)